using UnityEngine;

//有这行生成的脚本都是UTF-8形式的

namespace MyGame
{
    public class SelectModelUI : BaseUI<SelectModelUI>
    {
        public MyButton pvp_button;
        public MyButton pve_button;

        protected override void Awake()
        {
            //注册菜单
            UIManager.Instance.RegisterMenu(uIType, gameObject);

            RegisterAction();
        }

        private void Start()
        {
            Hide();
        }

        private void RegisterAction()
        {
            pvp_button.myAction_Click += () =>
            {
                UIManager.Instance.EnterSelect();
                GameManager.Instance.SetGameModel(GameManager.GameModel.pvp);
            };

            pve_button.myAction_Click += () =>
            {
                UIManager.Instance.EnterSelect();
                GameManager.Instance.SetGameModel(GameManager.GameModel.pve);
            };

            pvp_button.myAction_Enter += () =>
            {
                pvp_button.transform.localScale = Vector3.one * 1.2f;
                pvp_button.myImage.color = Color.yellow;
            };

            pvp_button.myAction_Exit += () =>
            {
                pvp_button.transform.localScale = Vector3.one * 1;
                pvp_button.myImage.color = Color.black;
            };

            pve_button.myAction_Enter += () =>
            {
                pve_button.transform.localScale = Vector3.one * 1.2f;
                pve_button.myImage.color = Color.yellow;
            };

            pve_button.myAction_Exit += () =>
            {
                pve_button.transform.localScale = Vector3.one * 1;
                pve_button.myImage.color = Color.black;
            };
        }

        private void OnDestroy()
        {
            //注销菜单
            UIManager.Instance.UnregisterMenu(uIType);
        }
    }
}

